package com.tencent.mid.util;

class c extends a
{
  private static final byte[] h;
  private static final byte[] i;
  int c;
  public final boolean d;
  public final boolean e;
  public final boolean f;
  private final byte[] j;
  private int k;
  private final byte[] l;

  static
  {
    if (!(Base64.class.desiredAssertionStatus()));
    for (int i1 = 1; ; i1 = 0)
    {
      g = i1;
      h = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47 };
      i = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95 };
      return;
    }
  }

  public c(int paramInt, byte[] paramArrayOfByte)
  {
    this.a = paramArrayOfByte;
    if ((paramInt & 0x1) == 0)
    {
      i1 = 1;
      this.d = i1;
      if ((paramInt & 0x2) != 0)
        break label101;
      i1 = 1;
      this.e = i1;
      if ((paramInt & 0x4) == 0)
        break label106;
      i1 = i2;
      this.f = i1;
      if ((paramInt & 0x8) != 0)
        break label111;
      paramArrayOfByte = h;
      this.l = paramArrayOfByte;
      this.j = new byte[2];
      this.c = 0;
      if (!(this.e))
        break label118;
    }
    label101: label106: label111: label118: for (paramInt = 19; ; paramInt = -1)
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              this.k = paramInt;
              return;
              i1 = 0;
            }
            i1 = 0;
          }
          i1 = 0;
        }
        paramArrayOfByte = i;
      }
  }

  public boolean a(byte[] paramArrayOfByte, int paramInt1, int paramInt2, boolean paramBoolean)
  {
    int i3;
    byte[] arrayOfByte1 = this.l;
    byte[] arrayOfByte2 = this.a;
    int i2 = 0;
    int i1 = this.k;
    int i5 = paramInt2 + paramInt1;
    switch (this.c)
    {
    default:
      i3 = -1;
      paramInt2 = paramInt1;
      paramInt1 = i3;
      if (paramInt1 == -1)
        break label1198;
      arrayOfByte2[0] = arrayOfByte1[(paramInt1 >> 18 & 0x3F)];
      arrayOfByte2[1] = arrayOfByte1[(paramInt1 >> 12 & 0x3F)];
      arrayOfByte2[2] = arrayOfByte1[(paramInt1 >> 6 & 0x3F)];
      i2 = 4;
      arrayOfByte2[3] = arrayOfByte1[(paramInt1 & 0x3F)];
      i1 -= 1;
      if (i1 != 0)
        break label1193;
      paramInt1 = i2;
      if (this.f)
      {
        paramInt1 = 5;
        arrayOfByte2[4] = 13;
      }
      i2 = paramInt1 + 1;
      arrayOfByte2[paramInt1] = 10;
      i1 = 19;
    case 0:
    case 1:
    case 2:
    }
    label1024: label1184: label1187: label1190: label1193: label938: label1198: for (paramInt1 = i2; ; paramInt1 = i2)
      while (true)
      {
        if (paramInt2 + 3 <= i5)
        {
          i2 = (paramArrayOfByte[paramInt2] & 0xFF) << 16 | (paramArrayOfByte[(paramInt2 + 1)] & 0xFF) << 8 | paramArrayOfByte[(paramInt2 + 2)] & 0xFF;
          arrayOfByte2[paramInt1] = arrayOfByte1[(i2 >> 18 & 0x3F)];
          arrayOfByte2[(paramInt1 + 1)] = arrayOfByte1[(i2 >> 12 & 0x3F)];
          arrayOfByte2[(paramInt1 + 2)] = arrayOfByte1[(i2 >> 6 & 0x3F)];
          arrayOfByte2[(paramInt1 + 3)] = arrayOfByte1[(i2 & 0x3F)];
          paramInt2 += 3;
          paramInt1 += 4;
          i1 -= 1;
          if (i1 != 0)
            break label1190;
          if (!(this.f))
            break label1187;
          i1 = paramInt1 + 1;
          arrayOfByte2[paramInt1] = 13;
          paramInt1 = i1;
        }
        while (true)
        {
          int i4;
          while (true)
          {
            do
              while (true)
              {
                do
                  while (true)
                  {
                    while (true)
                    {
                      i1 = paramInt1 + 1;
                      arrayOfByte2[paramInt1] = 10;
                      i2 = 19;
                      paramInt1 = i1;
                      i1 = i2;
                    }
                    i3 = -1;
                    paramInt2 = paramInt1;
                    paramInt1 = i3;
                  }
                while (paramInt1 + 2 > i5);
                i3 = this.j[0];
                paramInt2 = paramInt1 + 1;
                paramInt1 = paramArrayOfByte[paramInt1];
                i4 = paramArrayOfByte[paramInt2];
                this.c = 0;
                paramInt1 = (i3 & 0xFF) << 16 | (paramInt1 & 0xFF) << 8 | i4 & 0xFF;
                paramInt2 += 1;
              }
            while (paramInt1 + 1 > i5);
            i3 = this.j[0];
            i4 = this.j[1];
            paramInt2 = paramInt1 + 1;
            paramInt1 = paramArrayOfByte[paramInt1];
            this.c = 0;
            paramInt1 = (i3 & 0xFF) << 16 | (i4 & 0xFF) << 8 | paramInt1 & 0xFF;
          }
          if (paramBoolean)
          {
            if (paramInt2 - this.c == i5 - 1)
            {
              if (this.c > 0)
              {
                paramArrayOfByte = this.j;
                i2 = 1;
                i3 = paramArrayOfByte[0];
              }
              while (true)
              {
                i3 = (i3 & 0xFF) << 4;
                this.c -= i2;
                i4 = paramInt1 + 1;
                arrayOfByte2[paramInt1] = arrayOfByte1[(i3 >> 6 & 0x3F)];
                i2 = i4 + 1;
                arrayOfByte2[i4] = arrayOfByte1[(i3 & 0x3F)];
                paramInt1 = i2;
                if (this.d)
                {
                  i3 = i2 + 1;
                  arrayOfByte2[i2] = 61;
                  paramInt1 = i3 + 1;
                  arrayOfByte2[i3] = 61;
                }
                i2 = paramInt1;
                if (this.e)
                {
                  i2 = paramInt1;
                  if (this.f)
                  {
                    arrayOfByte2[paramInt1] = 13;
                    i2 = paramInt1 + 1;
                  }
                  arrayOfByte2[i2] = 10;
                  i2 += 1;
                }
                i3 = paramInt2;
                if ((g) || (this.c == 0))
                  break label1024;
                throw new AssertionError();
                i3 = paramArrayOfByte[paramInt2];
                paramInt2 += 1;
                i2 = 0;
              }
            }
            if (paramInt2 - this.c == i5 - 2)
              if (this.c > 1)
              {
                byte[] arrayOfByte3 = this.j;
                i2 = 1;
                i3 = arrayOfByte3[0];
                if (this.c <= 0)
                  break label938;
                i4 = this.j[i2];
                i2 += 1;
                i3 = (i4 & 0xFF) << 2 | (i3 & 0xFF) << 10;
                this.c -= i2;
                i2 = paramInt1 + 1;
                arrayOfByte2[paramInt1] = arrayOfByte1[(i3 >> 12 & 0x3F)];
                i4 = i2 + 1;
                arrayOfByte2[i2] = arrayOfByte1[(i3 >> 6 & 0x3F)];
                paramInt1 = i4 + 1;
                arrayOfByte2[i4] = arrayOfByte1[(i3 & 0x3F)];
                if (!(this.d))
                  break label1184;
                i2 = paramInt1 + 1;
                arrayOfByte2[paramInt1] = 61;
                paramInt1 = i2;
              }
          }
          while (true)
          {
            do
            {
              do
              {
                do
                {
                  while (true)
                  {
                    while (true)
                    {
                      while (true)
                      {
                        i2 = paramInt1;
                        if (this.e)
                        {
                          i2 = paramInt1;
                          if (this.f)
                          {
                            arrayOfByte2[paramInt1] = 13;
                            i2 = paramInt1 + 1;
                          }
                          arrayOfByte2[i2] = 10;
                          i2 += 1;
                        }
                        i3 = paramInt2;
                      }
                      i3 = paramArrayOfByte[paramInt2];
                      paramInt2 += 1;
                      i2 = 0;
                    }
                    i4 = paramArrayOfByte[paramInt2];
                    paramInt2 += 1;
                  }
                  i3 = paramInt2;
                  i2 = paramInt1;
                }
                while (!(this.e));
                i3 = paramInt2;
                i2 = paramInt1;
              }
              while (paramInt1 <= 0);
              i3 = paramInt2;
              i2 = paramInt1;
            }
            while (i1 == 19);
            if (this.f)
            {
              i2 = paramInt1 + 1;
              arrayOfByte2[paramInt1] = 13;
              paramInt1 = i2;
            }
            while (true)
            {
              while (true)
              {
                i2 = paramInt1 + 1;
                arrayOfByte2[paramInt1] = 10;
                i3 = paramInt2;
              }
              i4 = i2;
              if (!(g))
              {
                i4 = i2;
                if (i3 != i5)
                {
                  throw new AssertionError();
                  if (paramInt2 != i5 - 1)
                    break label1106;
                  arrayOfByte1 = this.j;
                  i2 = this.c;
                  this.c = (i2 + 1);
                  arrayOfByte1[i2] = paramArrayOfByte[paramInt2];
                }
              }
              for (i4 = paramInt1; ; i4 = paramInt1)
              {
                do
                {
                  this.b = i4;
                  this.k = i1;
                  return true;
                  label1106: i4 = paramInt1;
                }
                while (paramInt2 != i5 - 2);
                arrayOfByte1 = this.j;
                i2 = this.c;
                this.c = (i2 + 1);
                arrayOfByte1[i2] = paramArrayOfByte[paramInt2];
                arrayOfByte1 = this.j;
                i2 = this.c;
                this.c = (i2 + 1);
                arrayOfByte1[i2] = paramArrayOfByte[(paramInt2 + 1)];
              }
            }
          }
        }
        continue;
        paramInt1 = 4;
      }
  }
}